package P118_NoOverrideStartMethod;

import org.junit.Test;

/**
 * @ClassName : NoOverrideStartMethod
 * @Description : 不推荐覆写start方法
 * @Author : wukj1
 * @Date: 2022/5/6
 **/
public class NoOverrideStartMethod {

    public static void main(String[] args) {
        MultiThread multiThread = new MultiThread();
        multiThread.start();
        System.out.println("执行主线程");
    }

}

class MultiThread extends Thread{

//    @Override
//    public synchronized void start() {
//        run();
//    }

    @Override
    public void run() {
        try {
            Thread.sleep(3000);
            System.out.println("执行子线程");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
